﻿@using LotteryVoteMVC.Core.Application
@using LotteryVoteMVC.Core
@using LotteryVoteMVC.Models
@using LotteryVoteMVC.Resources
@using LotteryVoteMVC.Utility
@model IEnumerable<BetOrder>
@{
    ViewBag.Title = Resource.Company + Resource.Statistics;
    Layout = "~/Views/Shared/Main.cshtml";
}
@section Header
{
    <script src="@Url.Content("~/Scripts/Customer/SearchHelper.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.datepicker.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.datepicker-" + CultureHelper.GetCurrentCulture() + ".js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/Customer/TableBase.js")" type="text/javascript"></script>
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.theme.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.datepicker.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/TableBase.css")" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        $(document).ready(function () {
            $("#FromDate").attr("readonly", "readonly").datepicker();
            $("#ToDate").attr("readonly", "readonly").datepicker();
        });
    </script>
}
<div id="searchBar">
    @using (Html.BeginForm())
    {
        <span>@Resource.From</span>
        @Html.TextBox("FromDate",DateTime.Today.ToShortDateString())
        <span>@Resource.To</span>
        @Html.TextBox("ToDate", DateTime.Today.ToShortDateString())
        <span>@Resource.Company</span>
        @Html.Partial("~/Views/Partial/TodayCompany.cshtml", LotterySystem.Current.AllCompanyList, new ViewDataDictionary { { "HasAll", false } })
        <input type="submit" name="search" id="search" value="@Resource.Search" />
    }
</div>
@if (Model != null)
{ 
    <table>
        <thead>
            <tr>
                <td>@Resource.GameType
                </td>
                <td>@Resource.Turnover
                </td>
                <td>@Resource.Commission</td>
                <td>@Resource.WinLost
                </td>
                <td>@Resource.Win
                </td>
            </tr>
        </thead>
        @foreach (var order in Model)
        {
            <tr>
                <td>@Extended.GetGPWDescription(order.GamePlayWayId)
                </td>
                <td>@order.Turnover.ToString("N")
                </td>
                <td>@order.Commission.ToString("N")</td>
                <td>
                    <a target="_blank" href="/Report/WinLost?Company=@Request.QueryString["Company"]&FromDate=@Request.QueryString["FromDate"]&ToDate=@Request.QueryString["ToDate"]">@order.DrawResult.ToString("N")</a>
                </td>
                <td>
                    <a target="_blank" href="/Order/WinReport?Company=@Request.QueryString["Company"]&FromDate=@Request.QueryString["FromDate"]&ToDate=@Request.QueryString["ToDate"]">@order.NetWin.ToString("N")</a>
                </td>
            </tr>
        }
    </table>
}